Skip to content

Comments

Fixes #734: make noise a lazy import in datasets module#858

Open
brendancol wants to merge 1 commit intomasterfrom
fixes-734-move-noise-to-install_requires-at-the-setup.cfg
Open

Fixes #734: make noise a lazy import in datasets module#858
brendancol wants to merge 1 commit intomasterfrom
fixes-734-move-noise-to-install_requires-at-the-setup.cfg

Conversation

@brendancol
Copy link
Contributor

Summary

  • Move import noise from top-level in xrspatial/datasets/__init__.py to inside make_terrain(), guarded by try/except
  • Previously, from xrspatial.datasets import get_data would fail with ModuleNotFoundError: No module named 'noise' on a fresh pip install xarray-spatial since noise is only in [options.extras_require] tests
  • Now the module imports cleanly without noise, and make_terrain() raises a clear ImportError with install instructions

Test plan

  • Verified xrspatial.datasets imports successfully without noise installed
  • Verified make_terrain() works when noise is installed
  • Verified make_terrain() gives a clear error when noise is missing: ImportError: make_terrain requires the 'noise' package: pip install noise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant